﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chapter05.View
{
    /// <summary>
    /// Window.xaml 的交互逻辑
    /// </summary>
    public partial class KeyPressEventsWindow : Window
    {
        public KeyPressEventsWindow()
        {
            InitializeComponent();
        }

        private void TextBox_KeyEvent(object sender, KeyEventArgs e)
        {
            if ((bool)chkIgnorRepeat.IsChecked && e.IsRepeat)
                return;
            string message = "事件：" + e.RoutedEvent +
                " 键: " + e.Key;
            lstMessages.Items.Add(message);
        }

        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            string message = "事件：" + e.RoutedEvent +
                " 文本: " + e.Text;
            lstMessages.Items.Add(message);
        }

        private void TextBox_TextInput(object sender, TextCompositionEventArgs e)
        {
            
        }
    }
}
